home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 4.1 KB | 153 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWGC.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWGC_H
- #define FWGC_H
-
- #ifndef SLGRDEF_H
- #include "SLGrDef.h"
- #endif
-
- #ifndef SLGC_H
- #include "SLGC.h"
- #endif
-
- #ifndef SLGDEV_H
- #include "SLGDev.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWMAPING_H
- #include "FWMaping.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- // ----- Platform Includes -----
-
- #if defined(FW_BUILD_WIN) && !defined(_INC_WINDOWS)
- #include <windows.h>
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class ODShape;
- class ODCanvas;
- class ODTransform;
-
- struct FW_SPrivSuspendResumeState;
-
- //========================================================================================
- // class FW_CGraphicContext
- //========================================================================================
-
- class FW_CGraphicContext : public FW_SGraphicContext
- {
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- FW_DECLARE_AUTO(FW_CGraphicContext)
-
- virtual ~FW_CGraphicContext();
-
- protected:
- FW_CGraphicContext(Environment* ev);
-
- // ----- Init Graphic Context with a transform
- void InitGraphicContext(FW_HGDevice graphicDevice,
- ODTransform* transform,
- ODShape* clipShape);
-
- // ----- Terminate the Graphic Context
- void TerminateGraphicContext();
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Conversion -----
- FW_CPlatformPoint LogicalToDevice(FW_Fixed xSize, FW_Fixed ySize) const;
- FW_CPlatformPoint LogicalToDevice(const FW_CPoint& point) const;
- FW_CPlatformRect LogicalToDevice(const FW_CRect& rect) const;
- ODShape* LogicalToDevice(ODShape* shape) const;
-
- FW_CPoint DeviceToLogical(FW_PlatformCoordinate xSize, FW_PlatformCoordinate ySize) const;
- FW_CPoint DeviceToLogical(const FW_CPlatformPoint& point) const;
- FW_CRect DeviceToLogical(const FW_CPlatformRect& rect) const;
- ODShape* DeviceToLogical(ODShape* region) const;
-
- // ----- Clipping -----
- ODShape* AcquireClip() const; // the resulting shape belongs to the caller
- void SetClip(ODShape* odShape); // a copy of odShape is used
-
- void GetClipRect(FW_SRect& clipRect) const;
- void SetClipRect(const FW_SRect& clipRect);
-
- // ----- Mapping -----
- void SetMapping(const FW_SMapping& newMapping);
- void GetMapping(FW_CMapping& mapping) const;
-
- virtual void Reset() = 0;
-
- protected:
- void PrivReset(ODTransform* transform,
- ODShape* clipShape);
-
- //----------------------------------------------------------------------------------------
- // Getters for members defined in FW_SGraphicContext
- //
- public:
- FW_HGDevice GetGraphicDevice() const
- { return fGraphicDevice; }
-
- ODPlatformCanvas GetPlatformCanvas() const
- { return FW_PrivGDev_GetPlatformCanvas(fGraphicDevice); }
-
- Environment* GetEnvironment() const
- { return fEnvironment; }
-
- private:
- FW_CGraphicContext(const FW_CGraphicContext& other);
- FW_CGraphicContext& operator=(const FW_CGraphicContext& other);
- // Copy constructor and assignment operator not valid for this class.
- };
-
- //========================================================================================
- // class FW_CSaveRestoreContext
- //========================================================================================
-
- class FW_CSaveRestoreContext
- {
- public:
- FW_DECLARE_AUTO(FW_CSaveRestoreContext)
-
- FW_CSaveRestoreContext(FW_CGraphicContext& gc);
- virtual ~ FW_CSaveRestoreContext();
-
- private:
- FW_CGraphicContext& fGC;
- FW_SPrivSuspendResumeState* fSuspendResume;
- };
-
- #endif
-